package com.framework.yhbapi.controller;

import com.framework.exception.util.RespResult;
import com.framework.service.DeptSmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 功能描述: 发送过短信Controller
 *
 * @author ck
 * @date 2018/9/3 11:45
 */
@RestController
@Api(value="短信模块",tags={"短信模块"})
@RequestMapping(value = "yhbsms")
public class YhbSmsController {

	@Autowired
	private DeptSmsService deptSmsService;

	/**
	 *  发送各种类型短信
	 * @param phone 手机号码
	 * @param smsType 短信类型
	 */
	@PostMapping("sendSms")
	@ApiOperation("发送短信")
	@ApiImplicitParams({
			@ApiImplicitParam(name="deptId",value="渠道id",dataType="long", paramType = "query" ),
			@ApiImplicitParam(name="phone",value="手机号码",dataType="string", paramType = "query" ,required = true),
			@ApiImplicitParam(name="smsType",value="短信类型（登录:login 忘记密码:t_forget 添加银行卡:i_bank 修改银行卡：u_bank）",dataType="String", paramType = "query",required = true),
	})
	public RespResult sendSms(String phone,String smsType,Long deptId) {
		deptSmsService.sendYhbSms(phone,smsType,deptId);
		return RespResult.ok();

	}
}
